<!DOCTYPE html>
<html lang="en">

<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
   <title>Document</title>
</head>

<body>
   <script>
      var arr = [1, 1, 2, 2, 2, 3, 2, 4, 5, 5];
      var obj = {};
      arr.forEach(function(item){
         if(obj[item]){
            // obj[item]++;
            obj[item] += 1;
         }else{
            obj[item] = 1;
         }
      })
      console.log(obj);
      
     
      var str2 = ''
      for(var key in obj){
         console.log(key);
         
         str2 += key;
      }
      console.log(str2);
     var arr2 = str2.split('');
     console.log(arr2);
     
      
      
      
      
   </script>
</body>

</html>